package com.zhaoyue.study.redis;

import com.google.common.collect.Maps;
import redis.clients.jedis.Jedis;

import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 2016/12/19
 * Time: 15:01
 * To change this template use File | Settings | File Templates.
 */
public class FirstDemo {
    public static void main(String[] args) {
        Jedis jedis = new Jedis("192.168.56.56", 6379);
        //是否在线
        System.out.println(jedis.ping());

        //字符串
        jedis.set("name","Jue");
        System.out.println(jedis.get("name"));

        //hashMap
        Map<String,String> map = Maps.newHashMap();
        map.put("age","14");
        map.put("sex","男");
        jedis.hmset("zhaoyue",map);
        System.out.println(jedis.hmget("zhaoyue","age").get(0));

        //
        jedis.sadd("");





    }
}
